#coding=utf-8

def avg_filter(td, n=20, gt_or_lt='>'):
    
    v = td.avg_price(n)
    if not v:return False
    
    exp = '%f%s%f'%(td.close, gt_or_lt, v)
    return eval(exp)


